import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:http/http.dart' as http;

/*flutter复习*/
class Practice01 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("复习1"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text("url_launcher:可以打开url也可以是scheme"),
            RaisedButton(
              onPressed: () {
                const url = 'atwin://scheme.che168.com/launch';
                launch(url);
              },
              child: Text('打开'),
            ),
            Text('通过http发起请求'),
            RaisedButton(
              onPressed: () {
                var url = 'http://httpbin.org';
                http.get(url).then((response) {
                  print("状态：${response.statusCode}");
                  print("正文：${response.body}");
                });
              },
              child: Text('发送请求'),
            ),
          ],
        ),
      ),
    );
  }
}

//dart复习

class Rectangle {
  num left;
  num top;
  num width;
  num height;

  Rectangle(this.left, this.top, this.width, this.height);

  num get right => left + width;

  set right(num value) => left = value - width;

  num get bottom => top + height;

  set bottom(num value) => value - height;

  //定义操作符含义
  operator +(Rectangle rect) {
    print("+++");
  }
}

abstract class Object {

}

class Animal {
  void eat() {
    print('eat');
  }

  void run() {
    print('run');
  }
}
//可以实现多个抽象类(类似java中的接口)
class Human extends Animal implements DateBaseOperate,Object {
  void say() {
    print('say');
  }

  void study() {
    print('study');
  }

  @override
  void insert() {
  }
}

//定义抽象类

abstract class DateBaseOperate {
  void insert();


}


//枚举

enum Color {
  red,green,blue
}


//Mixins  实现多继承

class S {
  a(){
    print('S.a');
  }
}

class A {
  a(){
    print('A.a');
  }
  b(){
    print('A.b');
  }
}

class T = S with A;







main() {
  T t = T();
  t.a();
  t.b();

}
